/**
 * 简单封装一下
 */
let rsaUtil = {
  // RSA 位数，这里要跟后端对应
  bits: 1024,

  publicKey:"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCabEbIjuBw4+BjAJLkvkcBcqCdIkM5k+Tf7XQ4dgbF4XSBb6wKeleVfNs3bDFwnRN6Pt0ON+NHhUA7nU6B203hU+TGhbwKsuKG/eEjMQoxf8GoQwqBCIEn569nwksqKYzsPRi/Glf9o6VnADskz00osn4Km7Bfeg99ShtGmTKa1QIDAQAB",

  // 公钥加密
  encrypt: function (plaintext) {
    let RSA = new JSEncrypt({default_key_size: rsaUtil.bits,});
    RSA.setPublicKey(rsaUtil.publicKey);
    if (plaintext instanceof Object) {
      // 1、JSON.stringify
      plaintext = JSON.stringify(plaintext)
    }
    return RSA.encrypt(plaintext);
  },
};